package com.example.demo.controller;



import com.example.demo.pojo.Catitems;
import com.example.demo.pojo.Swiperdata;
import com.example.demo.service.FirstpageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

/**
 * @author yanglup
 * @create 2020-11-27 21:07
 */
@RestController
public class FirstpageController {
    @Autowired
    FirstpageService firstpageService;
    Logger log= Logger.getLogger("获取值");

    /**轮播图*/
    @RequestMapping("/home/swiperdata")
    public Map<String,Object> swiperdata(){
        List<Swiperdata> list=firstpageService.swiperdata();

        Map<String, Object> mymap = new HashMap<>();
        mymap.put("msg", "获取成功");
        mymap.put("status", 200);
        Map<String, Object> map = new HashMap<>();
        map.put("message", list);
        map.put("meta", mymap);
        return map;
    }

    /**导航*/
    @RequestMapping("/home/catitems")
    public Map<String,Object> catitems(){
        List<Catitems> list=firstpageService.catitems();

        Map<String, Object> mymap = new HashMap<>();
        mymap.put("msg", "获取成功");
        mymap.put("status", 200);
        Map<String, Object> map = new HashMap<>();
        map.put("message", list);
        map.put("meta", mymap);
        return map;
    }
}
